#[cfg(test)]
mod tests {
    use tauri_sip_client_lib::sip_manager::{SipManager, TransportType, RegistrationStatus};

    #[tokio::test]
    async fn test_sip_manager_creation() {
        let manager = SipManager::new();
        let status = manager.get_registration_status().await;
        
        // Should start unregistered
        matches!(status, RegistrationStatus::Unregistered);
    }

    #[tokio::test]
    async fn test_connection_test_udp() {
        let manager = SipManager::new();
        
        // Test UDP connection (should succeed in creating transport)
        let result = manager.test_connection(
            "127.0.0.1".to_string(),
            5060,
            TransportType::UDP
        ).await;
        
        assert!(result.is_ok());
        let test_result = result.unwrap();
        assert!(test_result.success);
        assert_eq!(test_result.transport_used, TransportType::UDP);
    }

    #[tokio::test]
    async fn test_connection_test_tcp() {
        let manager = SipManager::new();
        
        // Test TCP connection (should succeed in creating transport)
        let result = manager.test_connection(
            "127.0.0.1".to_string(),
            5060,
            TransportType::TCP
        ).await;
        
        assert!(result.is_ok());
        let test_result = result.unwrap();
        assert!(test_result.success);
        assert_eq!(test_result.transport_used, TransportType::TCP);
    }

    #[tokio::test]
    async fn test_connection_test_auto() {
        let manager = SipManager::new();
        
        // Test Auto connection (should try UDP first)
        let result = manager.test_connection(
            "127.0.0.1".to_string(),
            5060,
            TransportType::Auto
        ).await;
        
        assert!(result.is_ok());
        let test_result = result.unwrap();
        assert!(test_result.success);
        // Should use UDP as first choice
        assert_eq!(test_result.transport_used, TransportType::UDP);
    }

    #[tokio::test]
    async fn test_network_status() {
        let manager = SipManager::new();
        let status = manager.get_network_status().await;
        
        // Should start disconnected
        assert!(!status.is_connected);
        assert!(status.active_transport.is_none());
        assert!(status.local_address.is_none());
        assert!(status.server_address.is_none());
    }
}